var e = require;
var t = module;
var o = exports;
Object.defineProperty(o, "__esModule", {value: !0});
var n = e("BaseModuleUI"),
    a = e("NotifyEventType"),
    i = e("GlobalParams"),
    r = e("Game"),
    s = e("ObjectPool"),
    l = e("RoleSoldierInfo"),
    c = e("node_team"),
    d = e("team_node_info"),
    h = cc._decorator,
    _ = h.ccclass,
    u = h.property,
    p = (function (e) {
        function t() {
            var t = (null !== e && e.apply(this, arguments)) || this;
            return (
                (t.team_type = r.TeamInfo.left_team),
                (t.role_soldier_view = null),
                (t.add_num = 0),
                (t.soldier_list = [r.SoldierType.near_soldier, r.SoldierType.far_soldier, r.SoldierType.far_soldier]),
                t
            );
        }
        return (
            __extends(t, e),
            (t.prototype.addEvent = function () {
                this.attachEvent(a.default.SEND_CREATE_SOLDIER_INFO, this.showAddSoldier, this);
            }),
            (t.prototype.showAddSoldier = function () {
                var e = this;
                i.GlobalParams.GameStart &&
                    (this.createSoldier(this.soldier_list[this.add_num]),
                    this.add_num++,
                    this.add_num < this.soldier_list.length
                        ? this.scheduleOnce(function () {
                              e.showAddSoldier();
                          }, 3)
                        : (2 == i.GlobalParams.GameDestroyTower[this.team_type == r.TeamInfo.left_team ? 1 : 0] &&
                              this.createSuperSoldier(),
                          (this.add_num = 0)));
            }),
            (t.prototype.createSoldier = function (e) {
                for (var t = s.default.getInstance().creatPlane(r.Pool_Type.soldier), o = 0; o < 2; o++) {
                    var n = cc.instantiate(t),
                        a = {team: this.team_type, info: l.default.soldier_info[e], id: e};
                    n.getComponent(d.default).setNodeInfo(a), (n.name = "soldier_team_" + this.team_type);
                    var i = this.node.getPosition();
                    (i.y += 0 == o ? -300 : 100),
                        n.setPosition(i),
                        n.getComponent(c.default).setTeamInfo(this.team_type),
                        (n.active = !0),
                        n.setParent(this.role_soldier_view);
                }
            }),
            (t.prototype.createSuperSoldier = function () {
                var e = s.default.getInstance().creatPlane(r.Pool_Type.super_soldier),
                    t = cc.instantiate(e),
                    o = {
                        team: this.team_type,
                        info: l.default.soldier_info[r.SoldierType.super_soldier],
                        id: r.SoldierType.super_soldier
                    };
                t.getComponent(d.default).setNodeInfo(o), (t.name = "soldier_team_" + this.team_type);
                var n = this.node.getPosition();
                (n.y -= 140),
                    t.setPosition(n),
                    t.getComponent(c.default).setTeamInfo(this.team_type),
                    (t.active = !0),
                    t.setParent(this.role_soldier_view);
            }),
            __decorate([u({type: cc.Enum(r.TeamInfo)})], t.prototype, "team_type", void 0),
            __decorate([u(cc.Node)], t.prototype, "role_soldier_view", void 0),
            __decorate([_], t)
        );
    })(n.default);
o.default = p;
